import { Product } from '../entities/product';
import { ProductDto } from '../dtos';
import { DeepPartial } from 'typeorm';

export function entityToDto(e: Product): ProductDto {
  return {
    id: e.id,
    name: e.name,
    version: e.version,
    description: e.description
  };
}

export function dtoToEntity(dto: ProductDto): DeepPartial<Product> {
  return {
    id: dto.id,
    name: dto.name,
    version: dto.version,
    description: dto.description
  };
}